public class Work4 {
    public static int fib(int n) {
        if (n == 1 || n == 2) {
            return 1;
        } else {
            return fib(n - 1) + fib(n - 2);
        }
    }

    public static void main(String[] args) {
        //求斐波那契数列的第n项。(迭代实现) 1 1 2 3 5
        int n = 5;
        System.out.println(fib(n));
    }
}
